package 算法训练;

import java.util.Scanner;
import java.util.Stack;

/**
 * Created by lenovo on 2017/3/26.
 */
public class q156 {
    public static Stack<Character> sCh = new Stack<Character>(); //用于存放符号的符号栈
    public static Stack<Double> sNum = new Stack<Double>();//用于存放数据的数据栈
    public static char[] num = new char[105];
    public static char[] str1 = new char[105];

    /**
     * 计算加减乘除
     */
    private static void cal_1(){
        double n1,n2;
        char ch;
        ch = sCh.peek();
        while (ch != '(') {
            n1 = sNum.peek();
            sNum.pop();
            n2 = sNum.peek();
            sNum.pop();
            switch (ch) {
                case '+':
                    n2 += n1;
                    break;
                case '-':
                    n2 -= n1;
                    break;
                case '*':
                    n2 *= n1;
                    break;
                case '/':
                    n2 /= n1;
                    break;
            }
            sNum.push(n2);
            sCh.pop();
            ch=sCh.peek();
        }
    }

    private static void cal_2(){
        double n1,n2;
        char ch;
        ch = sCh.peek();
        while (ch == '*' || ch == '/') {
            n1 = sNum.peek();
            sNum.pop();
            n2 = sNum.peek();
            sNum.pop();
            if(ch == '*'){
                n2*=n1;
            } else if (ch == '/') {
                n2/=n1;
            }
            sNum.push(n2);
            sCh.pop();
            ch = sCh.peek();
        }
    }

    private static void init(){
        num = new char[105];
    }

    private static Double change(char[] ch){
        return Double.parseDouble(new String(ch));
    }
    public static void main(String[] args){

        int k = 0;
        double n;
        Scanner scanner = new Scanner(System.in);
        str1 = (scanner.nextLine()+"=").toCharArray();

        sCh.push('(');

        for(int i=0;i<str1.length;i++){
            if(str1[i]>='0' && str1[i]<='9' || str1[i] == '.'){
                num[k++] = str1[i];
                continue;
            }

            if(str1[i]!='(' ) {
                if(str1[i-1]!=')') {
                    sNum.push(change(num));
                    init();
                    k = 0;
                }
            }

            switch (str1[i]){
                case '+' :
                    cal_1();
                    sCh.push('+');
                    break;
                case '-' :
                    cal_1();
                    sCh.push('-');
                    break;
                case '*' :
                    cal_2();
                    sCh.push('*');
                    break;
                case '/' :
                    cal_2();
                    sCh.push('/');
                    break;
                case '(' :
                    sCh.push(str1[i]);
                    break;
                case ')' :
                    cal_1();
                    sCh.pop();
                    break;
                case '=' :
                    cal_1();
                    sCh.pop();
                    break;
            }
        }

        System.out.println(sNum.peek().intValue());
    }
}
